local filename = "agentcmd.lua"

local skynet = require "skynet"
local filelog = require "filelog"

local service = nil

-- 放到table里面，只是为了方便外界更改这个service
local AgentCMD = {
	service = nil
}

function AgentCMD.process(_, session, source, event, ...)
	-- 这段只是为了方便写代码一下，不想每个函数调用前都要加上
	-- local service = AgentCMD.service
	if not service then
		service = AgentCMD.service
	end
	local f = AgentCMD[event] 
	if f == nil then
		filelog.sys_error(filename.." line22 Agent AgentCMD.process invalid event:"..event)
		return nil
	end
	return f(...)
end

function AgentCMD.create_session(conf)
	return service:create_session(conf)
end

--直接关闭服务 
function AgentCMD.close( ... )
	service:agentexit(...)
end

--更新信息
function AgentCMD.updateroleinfo(...)
	return service:updateinfo(...)
end

--机器人进大厅
function AgentCMD.robot_entergame(...)
	return service:robot_entergame(...)
end

--机器人进入匹配
function AgentCMD.robot_entermatch(...)
	return service:robot_entermatch(...)
end

--机器人进桌
function AgentCMD.robot_entertable(...)
	return service:robot_entertable(...)
end

--机器人离桌
function AgentCMD.robot_leavetable(...)
	return service:robot_leavetable(...)
end

--注册逻辑处理模块
function AgentCMD.register_logicmodule(...)
	return service:register_logicmodule(...)
end

--延时离桌
function AgentCMD.delay_leavetable(...)
    return service:delay_leavetable(...)
end

--检测是否离桌
function AgentCMD.check_leavetable(...)
    return service:check_leavetable(...)
end

return AgentCMD